

$(".banner").mouseover(function(){
	$(".pre").css("opacity","1").stop().animate({left:"12%"},500);
	$(".next").css("opacity","1").show().stop().animate({right:"12%"},500);
}).mouseout(function(){
	$(".pre").stop().animate({left:"10%"},500).css("opacity","0.1");
	$(".next").stop().animate({right:"10%"},500).css("opacity","0.1");
})
//top piaofu
$(function(){
	$(window).scroll(function(){
     var header = $('#header');
     if(header.offset().top  - document.documentElement.scrollTop - document.body.scrollTop < 0) {
     $('#nav1').addClass('navfixed');
     } else {
     $('#nav1').removeClass('navfixed');
     }
  });
});
//marquee
this.imagePreview=function(){xOffset=10,yOffset=30,$("a.preview").hover(function(e){this.t=this.title,this.title="";var t=this.t!=""?"<br/>"+this.t:"";$("body").append("<div id='preview'><img src='"+this.rel+"' />"+t+"</div>"),$("#preview").css("top",e.pageY-xOffset+"px").css("left",e.pageX+yOffset+"px").fadeIn("fast")},function(){this.title=this.t,$("#preview").remove()}),$("a.preview").mousemove(function(e){$("#preview").css("top",e.pageY-xOffset+"px").css("left",e.pageX+yOffset+"px")})},$(document).ready(function(){imagePreview()}),function(e){e.fn.kxbdSuperMarquee=function(t){var n=e.extend({},e.fn.kxbdSuperMarquee.defaults,t);return this.each(function(){function t(){var e=n.direction=="left"||n.direction=="right"?"scrollLeft":"scrollTop";if(n.isMarquee){if(n.loop>0){_+=n.scrollAmount;if(_>d*n.loop)return f[e]=0,clearInterval(b)}var r=f[e]+(n.direction=="left"||n.direction=="up"?1:-1)*n.scrollAmount}else if(n.duration){if(!(w++<x)){r=T,clearInterval(m),y=!1;return}y=!0;var r=Math.ceil(o(w,E,S,x));w==x&&(r=T)}else{var r=T;clearInterval(m)}n.direction=="left"||n.direction=="up"?r>=d&&(r-=d):r<=0&&(r+=d),f[e]=r,n.isMarquee?b=setTimeout(t,n.scrollDelay):w<x?(m&&clearTimeout(m),m=setTimeout(t,n.scrollDelay)):y=!1}function r(e){y=!0;var r=n.direction=="left"||n.direction=="right"?"scrollLeft":"scrollTop",i=n.direction=="left"||n.direction=="up"?1:-1;M+=i,e==undefined&&n.navId&&(L.eq(O).removeClass("navOn"),O+=i,O>=C?O=0:O<0&&(O=C-1),L.eq(O).addClass("navOn"),M=O);var s=M<0?d:0;w=0,E=f[r],T=e!=undefined?e:s+n.distance*M%d,i==1?T>E?S=T-E:S=T+d-E:T>E?S=T-d-E:S=T-E,x=n.duration,m&&clearTimeout(m),m=setTimeout(t,n.scrollDelay)}function i(){g=setInterval(function(){r()},n.time*1e3)}function s(){clearInterval(g)}function o(e,t,n,r){return-n*(e/=r)*(e-2)+t}function u(e,t,n,r){return n*((e=e/r-1)*e*e*e*e+1)+t}var a=e(this),f=a.get(0),l=a.width(),c=a.height(),h=a.children(),p=h.children(),d=0,v=n.direction=="left"||n.direction=="right"?1:0,m,g,y,b,w,E,S,x,T,N,C,k,L,A=[],O=0,M=0,_=0;h.css(v?"width":"height",1e4);var D="<ul>";if(n.isEqual){N=p[v?"outerWidth":"outerHeight"](),C=p.length,d=N*C;for(var P=0;P<C;P++)A.push(P*N),D+="<li>"+(P+1)+"</li>"}else p.each(function(t){A.push(d),d+=e(this)[v?"outerWidth":"outerHeight"](),D+="<li>"+(t+1)+"</li>"});D+="</ul>";if(d<(v?l:c))return;h.append(p.clone()).css(v?"width":"height",d*2),n.navId&&(k=e(n.navId).append(D).hover(s,i),L=e("li",k),L.each(function(t){e(this).bind(n.eventNav,function(){if(y)return;if(O==t)return;r(A[t]),L.eq(O).removeClass("navOn"),O=t,e(this).addClass("navOn")})}),L.eq(O).addClass("navOn")),n.direction=="right"||n.direction=="down"?f[v?"scrollLeft":"scrollTop"]=d:f[v?"scrollLeft":"scrollTop"]=0,n.isMarquee?(b=setTimeout(t,n.scrollDelay),a.hover(function(){clearInterval(b)},function(){clearInterval(b),b=setTimeout(t,n.scrollDelay)}),n.controlBtn&&e.each(n.controlBtn,function(t,r){e(r).bind(n.eventA,function(){n.direction=t,n.oldAmount=n.scrollAmount,n.scrollAmount=n.newAmount}).bind(n.eventB,function(){n.scrollAmount=n.oldAmount})})):(n.isAuto&&(i(),a.hover(s,i)),n.btnGo&&e.each(n.btnGo,function(t,o){e(o).bind(n.eventGo,function(){if(y==1)return;n.direction=t,r(),n.isAuto&&(s(),i())})}))})},e.fn.kxbdSuperMarquee.defaults={isMarquee:!1,isEqual:!0,loop:0,newAmount:3,eventA:"mousedown",eventB:"mouseup",isAuto:!0,time:5,duration:50,eventGo:"click",direction:"left",scrollAmount:1,scrollDelay:10,eventNav:"click"},e.fn.kxbdSuperMarquee.setDefaults=function(t){e.extend(e.fn.kxbdSuperMarquee.defaults,t)}}(jQuery);
$(function(){$('#marquee1').kxbdSuperMarquee({distance:212,time:3,btnGo:{left:'#goL',right:'#goR'},direction:'left'});});

var a=1;
var leng=720;
var num=$(".zjgd_tx").find("li").length-1;
function scrollleft(){
	$(".zjhdnr").stop().animate({marginLeft:"-"+leng+"px"},1000);
	for(var i=0;i<=num;i++){
		if(a==i){
			$(".zjgd_tx").find("li").eq(i).addClass("active");
			$("#scjs").find("ul").eq(i).show();
		}else{
			$(".zjgd_tx").find("li").eq(i).removeClass("active");
			$("#scjs").find("ul").eq(i).hide();
		}
	}
	leng=leng+720;
	a=a+1;
	if(a>=4){a=0}
	if(leng==2880){leng=0}
}
$("#jtl").click(function(){scrollleft()});
$("#jtr").click(function(){scrollleft()});
$(".zjgd_tx li").click(function(){
	for(var f=0;f<=num;f++){
		if($(".zjgd_tx li").index(this)==f){
			$("#scjs").find("ul").eq(f).show();
			$(".zjgd_tx li").eq(f).addClass("active");
			var lef=720*f;
			$(".zjhdnr").stop().animate({marginLeft:"-"+lef+"px"},1000);
		}else{
			$("#scjs").find("ul").eq(f).hide();
			$(".zjgd_tx li").eq(f).removeClass("active");
		}
	}
});
var b=1;
//var leng=550;
var b_leng=420;
var num=$(".mkzj_r ul").find("li").length-1;
function scrolllefttop(){
	$(".zj_l").stop().animate({marginLeft:"-"+b_leng+"px"},1000);
        var _page =  parseInt(b/3);
        for(var i=0;i<=num;i++){
		if(b==i){
			$(".mkzj_r").find("li").eq(i).addClass("active");
			$('.mkzj_ul ul').animate( {"left": "-"+(_page*110)+"px"} );
		}else{
			$(".mkzj_r").find("li").eq(i).removeClass("active");
		}
	}
	b_leng=b_leng+420;
	b=b+1;
	if(b>=4){b=0}
	if(b_leng==1680){b_leng=0}  
}
$("#zjjtr").click(function(){scrolllefttop()});
$(".mkzj_r ul li").click(function(){
	for(var f=0;f<=num;f++){
		if($(".mkzj_r ul li").index(this)==f){
			$(".mkzj_r ul li").eq(f).addClass("active");
			var lef=420*f;
			$(".zj_l").stop().animate({marginLeft:"-"+lef+"px"},1000);
		}else{
			$(".mkzj_r ul li").eq(f).removeClass("active");
		}
	}
	
});
/*$(".nxjk").mouseover(function(){
		$(this).children("ul").eq(0).show().stop(true).animate({height:'412px'});
}).mouseout(function(){
		$(this).children("ul").eq(0).stop().animate({height:'412px'}).hide(1);
});*/
$(".nxjkr li").mouseover(function(){
	$(this).children("a").eq(0).stop().animate({height:"0px"},100);
}).mouseout(function(){
	$(this).children("a").eq(0).stop().animate({height:"50px"},100);
});
(function($) {
	$.fn.banner = function(o) {
		$.extend({
			time: 400,
			animStyle: true,
			addclass:addclass
		},
		o || {});
		var iNow = 0;
		var timer = null;
		var oDiv = $(this);
		var oUl = oDiv.children('ul');
		var aLi = $('li', oUl);
		var oneSize = aLi.eq(0).width();
		var animStyle = o.animStyle ? 'left': 'opacity';
		var addclass=o.addclass;
		//alert(oneSize);
		var time = o.time;
		oDiv.css({
			'position': 'relative'
		});
		$('<div class="banner_index"><ul></ul></div>').appendTo(oDiv);
		var bannerIndex = $('.banner_index ul', oDiv);

		aLi.each(function(i) {
			if (animStyle == 'opacity') {
				if ($(this).index() == 0) {
					$(this).css({
						'opacity': 1
					});
				
				} else {
					$(this).css({
						'opacity': 0
					});
					
				}
				$(this).css({
					'position': 'absolute',
					'left': 0,
					'top': 0
				});
			} else {
				oUl.css({
					'width': oneSize * aLi.size(),
					'position': 'absolute',
					'left': 0
				});
			}
			$('<li></li>').appendTo(bannerIndex);
		});
		$('li', bannerIndex).css({
			'background-image': 'url(/templets/default/images/banner_index_white.png)'
		});
		$('li', bannerIndex).eq(iNow).css({
			'background-image': 'url(/templets/default/images/banner_index_red.png)'
		});		
		aLi.eq(iNow).addClass(addclass);
		var _this = aLi;
		function fnNext(iNow) {
			_this.eq(iNow).addClass(addclass).siblings('li').removeClass(addclass);
			
			$('li', bannerIndex).eq(iNow).css({
				'background-image': 'url(/templets/default/images/banner_index_red.png)'
			}).siblings('li').css({
				'background-image': 'url(/templets/default/images/banner_index_white.png)'
			});
			if (!o.animStyle) {
				for (var i = 0; i < _this.length; i++) {
					if (i > iNow) {
						_this.eq(i).stop(true, true).animate({
							'opacity': 0,
							'z-index':9999
						},
						time);
					} else if (i < iNow) {
						_this.eq(i).stop(true, true).animate({
							'opacity': 0,
							'z-index':9999
						},
						time);
					} else {
						_this.eq(i).stop(true, true).animate({

							'opacity': 1,
							'z-index':9999
						},
						time);
					}
				}
			} else {
				oUl.stop().animate({
					'left': -iNow * oneSize
				});
			}

		}

		timer = setInterval(function() {
			if (iNow == _this.length - 1) {
				iNow = 0
			} else {
				iNow++;

			}
			fnNext(iNow);
		},
		7000);

		$('li', bannerIndex).each(function() {

			$(this).mouseover(function() {
				clearInterval(timer);
				iNow = $(this).index();
				fnNext(iNow);				
				
			});
			$(this).mouseout(function() {	
				clearInterval(timer);
				timer = setInterval(function() {
					if (iNow == _this.length - 1) {
						iNow = 0
					} else {
						iNow++;

					}
					fnNext(iNow);
				},
				7000);
			});

		});
	}
})(jQuery);
//banner
$(function() {
	var len = $("#focusindex ul li").length;
	var index = 0;
	var picTimer;
	var btn = "<div class='btn'>";
	for(var i=0; i < len; i++) {
		btn += "<span></span>";
	}
	btn += "</div><div class='preNext pre'></div><div class='preNext next'></div>";
	$("#focusindex").append(btn);
	$("#focusindex .btn span").css("opacity",1).mouseover(function() {
		index = $("#focusindex .btn span").index(this);
		showPics(index);
	}).eq(0).trigger("mouseover");
	$("#focusindex .pre").click(function() {
		index -= 1;
		if(index == -1) {index = len - 1;}
		showPics(index);
	});

	//下一页按钮
	$("#focusindex .next").click(function() {
		index += 1;
		if(index == len) {index = 0;}
		showPics(index);
	});
	window.setInterval(function(){
		index += 1;
		if(index == len) {index = 0;}
		showPics(index);
	},9000);
	//IPAI
	$("#focusindex").on("swiperight",function(){
		index -= 1;
		if(index == -1) {index = len - 1;}
		showPics(index);
	});
	
$("#focusindex").on("swipeleft",function(){
		index += 1;
		if(index == len) {index = 0;}
		showPics(index);
	});
	$("#focusindex").hover(function() {
		window.clearInterval(picTimer);
	},function() {
		picTimer = window.setInterval(function() {
			showPics(index);
			index++;
			if(index == len) {index = 0;}
		},1000);
	}).trigger("mouseleave");
	function showPics(index) {
		$("#focusindex .btn span").stop(true,false).removeClass("on").eq(index).stop(true,false).addClass("on"); 
		$("#focusindex ul li").stop(true,false).animate({"opacity":"0"},1500).css("z-index",0).removeClass("bannerdh").eq(index).stop(true,false).animate({"opacity":"1"},1500).addClass("bannerdh").css("z-index",1); //为当前的按钮切换到选中的效果
	}
});
//tjleft  技术切换
function nTabs(thisObj,Num){
if(thisObj.className == "active")return;
var tabObj = thisObj.parentNode.id;
var tabList = document.getElementById(tabObj).getElementsByTagName("li");
for(i=0; i <tabList.length; i++)
{
  if (i == Num)
  {
   thisObj.className = "active"; 
      document.getElementById(tabObj+"_Content"+i).style.display = "block";
  }else{
   tabList[i].className = "normal"; 
   document.getElementById(tabObj+"_Content"+i).style.display = "none";
  }
} 
}
/*js fengzhuang*/
function aboutSwitch( width , last , next , layout , everytime , everytag , isSwitchQuick , isSQleft , isSQClass , isSQcheClass ){
	this.width = width;			//每次轮播宽度
	this.last = last;			//轮播下一个
	this.next = next;			//轮播上一个
	this.layout = layout;		//轮播外的布局
	this.carouselStart = about;	//轮播开始
	this.everytime = everytime; //轮播间隔时间
	this.everytag = everytag;
	this.isSwitchQuick = isSwitchQuick;
	this.isSQleft = isSQleft;
	this.isSQClass = isSQClass;
	this.isSQcheClass = isSQcheClass;
	
	var _this = this;			//保存自身
	
	function about(){			//轮播函数
		_this.layout.parentNode.style.width = _this.width + "px";
		var lEle = getChildTagElment( _this.layout , _this.everytag );
		
		if( lEle.length ){
			
			for( var i = 0 ; i < lEle.length ; i++ ){
				lEle[i].style.width = _this.width + "px";
			}
			
			_this.layout.imgIndex = 0;
			var img = _this.layout.getElementsByTagName( _this.everytag );
			
			if( _this.isSwitchQuick ){
				for( i = 0 ; i < img.length ; i ++ ){	//创建可点击小方框
					var jump = document.createElement( "a" );
					jump.className = "jump";
					jump.imgIndex = img.length - i - 1;
					jump.style.right = 10 + _this.isSQleft * i + "px";
					jump.innerHTML = img.length - i;
					jump.onmouseover = function(){
						animaLayout( this.imgIndex , _this.layout.imgIndex );
						clearInterval( _this.layout.imgInterval );
					}
					
					_this.layout.parentNode.insertBefore( jump , _this.layout.parentNode.children[0] ); //添加为外框子元素
				}
			}
			if( _this.last ){
				_this.last.onmouseover = function(){elemtAnimation( this , "opacity" , 1 );clearInterval( _this.layout.imgInterval );}
				_this.last.onmouseout = function(){elemtAnimation( this , "opacity" , 1 );}
				_this.last.onclick = function(){
					var imgIndex = _this.layout.imgIndex >= ( i - 1 )  ? 0 : _this.layout.imgIndex + 1;
					var cleInter = imgIndex - 1 < 0 ? (i - 1) : imgIndex - 1
					
					animaLayout( imgIndex ,cleInter )
				};
			}
			if( _this.next ){
				_this.next.onmouseover = function(){elemtAnimation( this , "opacity" , 1 );clearInterval( _this.layout.imgInterval );}
				_this.next.onmouseout = function(){elemtAnimation( this , "opacity" , 1 );}
				_this.next.onclick = function(){
					var imgIndex = _this.layout.imgIndex <= 0  ? i - 1 : _this.layout.imgIndex - 1;
					var cleInter = imgIndex + 1 >= i ? 0 : imgIndex + 1;
					
					animaLayout( imgIndex ,cleInter )
				};
			}
			_this.layout.onmouseover = function(){clearInterval( _this.layout.imgInterval );}
			_this.layout.onmouseout = function(){initialiLayout( i );}
			initialiLayout( i );
		}
		animaLayout(  0 , 0 )
	}
	
	function initialiLayout( i ){
		clearInterval(_this.layout.imgInterval);
		_this.layout.imgInterval = setInterval(function(){
			var imgIndex = _this.layout.imgIndex >= ( i - 1 )  ? 0 : _this.layout.imgIndex + 1;
			var cleInter = imgIndex - 1 < 0 ? (i - 1) : imgIndex - 1
			animaLayout( imgIndex , cleInter );
		},_this.everytime);
	}
	
	function animaLayout(  imgIndex , cleInter ){
		if( _this.isSwitchQuick ){
			_this.layout.parentNode.getElementsByTagName("a")[cleInter].className = _this.isSQClass;
			_this.layout.parentNode.getElementsByTagName("a")[imgIndex].className = _this.isSQClass + " " + _this.isSQcheClass;
		}
		_this.layout.imgIndex = imgIndex;
		elemtAnimation( _this.layout , "marginLeft" , imgIndex * -_this.width );
	}
}

function getChildTagElment( obj , tagName ){
	var tabCon = [];
		for( var i = 0 ; i < obj.children.length ; i ++ )
			if ( obj.children[i].tagName.toLowerCase() == tagName.toLowerCase() )
				tabCon.push( obj.children[i] );
	return tabCon;
}

function getStyle( obj , attr ){
	try{
		return window.getComputedStyle( obj , null )[attr]
	}catch(e){ 
		return parseInt( obj.currentStyle[attr] ) || 0;
	}
}

function elemtAnimation( obj , attr , attrVal , endFn ){
	var diffVal = parseInt(( attrVal - parseFloat( getStyle( obj , attr ) ) ) * 100 ) / 100;
	var averVal = diffVal / 2000;
	
	clearInterval( obj.interval );
	
	obj.interval = setInterval(function(){
		averVal = averVal * 1.25;
		var nextVal = parseInt( parseFloat( getStyle( obj , attr ) ) * 100 ) / 100;
		var togiveVal = nextVal + averVal;
		
		if( ( diffVal > 0 && togiveVal < attrVal ) || ( diffVal < 0 && togiveVal > attrVal ) ){
			togiveVal = attr == "opacity" ? togiveVal : togiveVal + "px";
			obj.style[attr] = togiveVal;
		}else{
			attrVal = attr == "opacity" ? attrVal : attrVal + "px";
			obj.style[attr] = attrVal;
			clearInterval( obj.interval );
			endFn && endFn();
		}
	},30);
}

function getElementsByClassName( className ){
	var clsArrs = [];
	var pagElement = document.getElementsByTagName( "*" );
	for( var i = 0 ; i < pagElement.length ; i ++ ){
		if( pagElement[i].className ){
			
			var clsNames = pagElement[i].className.split(" ");
			for( var j = 0 ; j < clsNames.length ; j ++ ){
				if(clsNames[j] == className){
					clsArrs.push( pagElement[i] );
					break;
				}
			}
		}
	}
	
	return clsArrs;
}
//syhd
var as = new aboutSwitch();
as.width = 290;										//轮播一屏的宽度
as.everytag = "div";								//轮播标签
as.layout = document.getElementById("layoutFrom");	//包住全部换屏的div盒子
as.everytime = 3000;								//换一屏的时间
as.isSwitchQuick = true;							//是否有小方块切换控件
as.isSQleft = 25;									//每个小方块之间的距离   (注意要包含自身宽度)
as.isSQClass = 'jump';
as.isSQcheClass = "jumpche";
as.layout && as.carouselStart();
//jinqi			
var as1 = new aboutSwitch();
as1.width = 246;									//轮播一屏的宽度
as1.everytag = "div";								//轮播标签
as1.layout = document.getElementById("jinqiFrom");	//包住全部换屏的div盒子
as1.everytime = 2000;								//换一屏的时间
as1.layout && as1.carouselStart();
//pzff			
var as2 = new aboutSwitch();
as2.width = 753;									//轮播一屏的宽度
as2.everytag = "div";
as2.next = document.getElementById("pzlast");		//点击上一张的dom对象
as2.last = document.getElementById("pznext");									//轮播标签
as2.layout = document.getElementById("pzffFrom");	//包住全部换屏的div盒子
as2.everytime = 2000;								//换一屏的时间
as2.layout && as2.carouselStart();
//zjhd
var as3 = new aboutSwitch();
as3.width = 230;										//轮播一屏的宽度
as3.everytag = "div";								//轮播标签
as3.layout = document.getElementById("zjfrom");		//包住全部换屏的div盒子
as3.everytime = 3000;								//换一屏的时间
as3.isSwitchQuick = true;							//是否有小方块切换控件
as3.isSQleft = 30;									//每个小方块之间的距离   (注意要包含自身宽度)
as3.isSQClass = 'jump';
as3.isSQcheClass = "jumpche";
as3.layout && as3.carouselStart();
as3.layout && $(".jump").html("");
